package model.sequent;

/**
 * @author Karen Berntsen (s0815799)
 * @author Erik Stens (s0615374)
 */
public enum SequentToken {
	ATOM("<atom>"), OR("|", true), AND("&", true), NOT("!"), IMPLICATE(">", false), BI_IMPLICATE("=", true), SEQUENT("@", true), BRACKET_OPEN("("), BRACKET_CLOSE(")"), COMMA(","), EOF("EOF");
	
	private String	name;
	private boolean	commutative;
	
	private SequentToken(String name) {
		this.name = name;
		commutative = false;
	}
	
	private SequentToken(String name, boolean commutative) {
		this.name = name;
		this.commutative = commutative;
	}
	
	/**
	 * Whether an operator is commutative, meaning (A operator B) == (B operator A). Of course this has no meaning for tokens that don't represent a binary operator, but in Java there's no easy way to extend an enum (as it should be).
	 * 
	 * @return true if the operator is commutative
	 */
	public boolean isCommutative() {
		return commutative;
	}
	
	@Override
	public String toString() {
		return name;
	}
}
